package com.erpoa.config;

import com.erpoa.service.ImaFileService;
import lombok.extern.apachecommons.CommonsLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author chenjimin
 * @Title: EmailTask
 * @ProjectName oaerp
 * @Description: TODO
 * @date 2020/11/1416:32
 */
@Component
@Configuration
@EnableScheduling
@CommonsLog
public class EmailTask {

    private static final Logger logger = LoggerFactory.getLogger(EmailTask.class);

    @Autowired
    private ImaFileService imaService;

    @Autowired
    private ServiceInfoUtil serviceInfoUtil;

  //  @Scheduled(cron="*/5 * * * * ?")
  @Scheduled(cron="54 45 1 * * ?")
    public void taskEndFissionWanted(){
        logger.info("54 45 4 * * ?");
        if ("1054".equals(serviceInfoUtil.getPort())){
            return;
        }
        imaService.sendMailAttachment("185469");
    }
}
